package com.bestcem.xm.om.dao.impl;

import com.bestcem.xm.om.dao.UserSubmoduleDao;
import com.bestcem.xm.om.dao.mapper.UserSubmoduleMapper;
import com.bestcem.xm.om.entity.UserSubmodule;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * @author zhangfeng <feng.zhang@idiaoyan.com>
 * @version v1.0
 * @date 2022/6/22 14:48
 */
@Repository
public class UserSubmoduleDaoImpl implements UserSubmoduleDao {
    @Resource
    private UserSubmoduleMapper userSubmoduleMapper;

    @Override
    public UserSubmodule queryById(String id) {
        return userSubmoduleMapper.queryById(id);
    }

    @Override
    public List<UserSubmodule> queryAllByLimit(UserSubmodule userSubmodule) {
        return userSubmoduleMapper.queryAllByLimit(userSubmodule);
    }

    @Override
    public long count(UserSubmodule userSubmodule) {
        return userSubmoduleMapper.count(userSubmodule);
    }

    @Override
    public int insert(UserSubmodule userSubmodule) {
        return userSubmoduleMapper.insert(userSubmodule);
    }

    @Override
    public int insertBatch(List<UserSubmodule> entities) {
        return userSubmoduleMapper.insertBatch(entities);
    }

    @Override
    public int insertOrUpdateBatch(List<UserSubmodule> entities) {
        return userSubmoduleMapper.insertOrUpdateBatch(entities);
    }

    @Override
    public int update(UserSubmodule userSubmodule) {
        return userSubmoduleMapper.update(userSubmodule);
    }

    @Override
    public int deleteById(String id) {
        return userSubmoduleMapper.deleteById(id);
    }

    @Override
    public List<UserSubmodule> listByIds(List<String> ids) {
        if (CollectionUtils.isEmpty(ids)) {
            return Collections.emptyList();
        }
        return userSubmoduleMapper.listByIds(ids);
    }

    @Override
    public List<UserSubmodule> listSubModule() {
        return userSubmoduleMapper.listSubModule();
    }

    @Override
    public UserSubmodule findOneByCode(String code) {
        return userSubmoduleMapper.findOneByCode(code);
    }

    @Override
    public int updateByCode(UserSubmodule existSubmodule) {
        return userSubmoduleMapper.update(existSubmodule);
    }
}

